home *** CD-ROM | disk | FTP | other *** search
/ Technotools / Technotools (Chestnut CD-ROM)(1993).ISO / lang_c / ctutor2 / switch.c < prev    next >
Text File  |  1986-03-29  |  768b  |  24 lines

  1. main()
  2. {
  3. int truck;
  4.  
  5.    for (truck = 3;truck < 13;truck = truck + 1) {
  6.  
  7.       switch (truck) {
  8.          case 3  : printf("The value is three\n");
  9.                    break;
  10.          case 4  : printf("The value is four\n");
  11.                    break;
  12.          case 5  :
  13.          case 6  :
  14.          case 7  :
  15.          case 8  : printf("The value is between 5 and 8\n");
  16.                    break;
  17.          case 11 : printf("The value is eleven\n");
  18.                    break;
  19.          default : printf("It is one of the undefined values\n");
  20.                    break;
  21.       } /* end of switch */
  22.  
  23.    } /* end of for loop */
  24. }